package com.fjec.wx.schedule.handler;

import com.fjec.common.schedule.BaseScheduleHandler;
import com.fjec.common.wx.WxAccessTokenHelper;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class AccessTokenHandler extends BaseScheduleHandler {

    @Resource
    private WxAccessTokenHelper wxAccessTokenHelper;

    public String handle() {
        String result;
        try {
            String accessToken = wxAccessTokenHelper.cacheAccessToken();
            result = String.format("Get accessToken success![%s]", accessToken);
        } catch (Exception ex) {
            result = String.format("Get accessToken error: [%s], TraceId: [%s]."
                    , ex.getMessage(), this.error(ex));
        }
        return result;
    }
}
